package shapes;

public class IsocelesTriangle extends Triangle {

    public IsocelesTriangle(int height) {

        super(height);
        data = new char[height][2 * height - 1];
    }

    public void createLeftIndentedIsocelesTriangle(int indent) {
        int noOfAsterisks = 1;
        String Asterisk = null;
        StringUtilities stringUtilities = new StringUtilities();

        for(int i = 0; i < height; i++) {
            Asterisk = stringUtilities.characterRepeat(noOfAsterisks);
            data[i] = stringUtilities.padCenter(Asterisk,2 * (height + indent) - 1).toCharArray();
            noOfAsterisks += 2;
        }
    }

    public void createLeftIndentedInvertedIsocelesTriangle(int indent) {
        int noOfAsterisks = 2 * height -1;
        String Asterisk = null;
        StringUtilities stringUtilities = new StringUtilities();

        System.out.println();
        for(int i = 0; i < height; i++) {
            Asterisk = stringUtilities.characterRepeat(noOfAsterisks);
            data[i] = stringUtilities.padCenter(Asterisk,2 * (height + indent) - 1).toCharArray();
            noOfAsterisks -= 2;
        }
    }

    @Override
    public void create() {
        createLeftIndentedIsocelesTriangle(0);
    }
}
